<style type="text/css">
	.panel-alphabet{
		margin-bottom:20px;
		height:100px;
	}	
</style>
<div class="panel-alphabet">
	<div class="text-right">	
		<div class="btn-group" style="margin-bottom:10px;">			
			<?php switch ($current_language) { 
					case 'e': case 'E':{ ?>
						<a class="btn" href="<?php print base_url(); ?>cafe">ทั้งหมด</a>
						<a class="btn btn-primary" href="<?php print base_url(); ?>cafe?u=e">A-Z</a>
						<a class="btn" href="<?php print base_url(); ?>cafe?u=t">ก-ฮ</a>
						<a class="btn" href="<?php print base_url(); ?>cafe?u=n">0-9</a>
			<?php 	}
					break; 
					case 't': case 'T':{ ?>
						<a class="btn" href="<?php print base_url(); ?>cafe">ทั้งหมด</a>
						<a class="btn" href="<?php print base_url(); ?>cafe?u=e">A-Z</a>
						<a class="btn btn-primary" href="<?php print base_url(); ?>cafe?u=t">ก-ฮ</a>
						<a class="btn" href="<?php print base_url(); ?>cafe?u=n">0-9</a>
			<?php	}
					break; 
					case 'n': case 'N':{ ?>
						<a class="btn" href="<?php print base_url(); ?>cafe">ทั้งหมด</a>
						<a class="btn" href="<?php print base_url(); ?>cafe?u=e">A-Z</a>
						<a class="btn" href="<?php print base_url(); ?>cafe?u=t">ก-ฮ</a>
						<a class="btn btn-primary" href="<?php print base_url(); ?>cafe?u=n">0-9</a>
			<?php 	}
					break; 
					default: { ?>
						<a class="btn btn-primary" href="<?php print base_url(); ?>cafe">ทั้งหมด</a>
						<a class="btn" href="<?php print base_url(); ?>cafe?u=e">A-Z</a>
						<a class="btn" href="<?php print base_url(); ?>cafe?u=t">ก-ฮ</a>
						<a class="btn" href="<?php print base_url(); ?>cafe?u=n">0-9</a>
			<?php	}
			 		break;
			 	} ?>		
		</div>
	</div>
	<ul class="unstyled inline">
	<?php for ($i=0; $i<count($alphabet); $i++) { ?>
		<li><a href="<?php print base_url() . 'cafe?p=' . $page_start_index . '&c=' . $alphabet[$i];
							if (!empty($current_language))
								print '&u=' . $current_language; ?>"><?php print $alphabet[$i]; ?></a></li>
	<?php } ?>
	</ul>	
</div>
<hr />
<div>	
	<ul class="unstyled thumb-list">
		<?php if (count($cafe_list) > 0): 
				for ($i=0; $i<count($cafe_list); $i++){ ?>
					<li class="underline row-fluid">						
						<img class="thumb" src="<?php print $cafe_list[$i]['CAF_IMG_L_FILENAME']; ?>" width="70" height="70" />						
						<div class="span5">
							<ul class="unstyled">
								<li style="height:45px; font-size:12pt;"><a href="<?php print base_url() . $cafe_list[$i]['CAF_NAME']; ?>" target="_blank"><?php print $cafe_list[$i]['CAF_TITLE']; ?></a></li>
								<li style="font-size:10pt;">จังหวัด: <?php print implode(',', array_unique($cafe_list[$i]['PROVINCE_LIST'])); ?></li>
							</ul>						
						</div>
						<div class="span5 text-right">
							<ul class="unstyled inline">													
							<?php for ($j=0; $j<count($cafe_list[$i]['CAF_IMG_C_LIST']); $j++) {?>
								<li><img class="thumbnail preview-thumbnail" 
										style="margin:0 -5px; cursor:hand; cursor:pointer" 
										src="<?php print $cafe_list[$i]['CAF_IMG_C_LIST'][$j]['CAF_IMG_C_FILENAME']; ?>" 
										rel="popover" data-trigger="hover" data-placement="left" 
										data-content="<img src='<?php print $cafe_list[$i]['CAF_IMG_C_LIST'][$j]['CAF_IMG_C_FILENAME']; ?>' />"/></li>
							<?php } ?>
							</ul>
						</div>
					</li>
		<?php 	}
			  else: ?>
			  	<p class="alert text-center">				 
					<strong>ไม่พบข้อมูล</strong>
				</p>
		<?php endif;?>
	</ul>	
</div>          
<div>
	<div class="pagination">
		<?php if ($page_count > 0){?>	
			<ul>
			    <li><a href="<?php print base_url() . 'cafe?p=1';
			    		if (!empty($current_alphabet))
			    			print '&c=' . $current_alphabet; 
			    		if (!empty($current_language))
			    			print '&u=' . $current_language; ?>">First</a></li>    
			    <?php for ($i=0; $i<$page_count; $i++) {?>
			      	<li><a href="<?php print base_url() . 'cafe?p=' . ($i+1);
			      		if (!empty($current_alphabet))
			    			print '&c=' . $current_alphabet; 
			    		if (!empty($current_language))
			    			print '&u=' . $current_language; ?>"><?php print $i+1; ?></a></li>
			    <?php }?>
			    <li><a href="<?php print base_url() . 'cafe?p=' . $page_count; 
			    		if (!empty($current_alphabet))
			    			print '&c=' . $current_alphabet; 
			    		if (!empty($current_language))
			    			print '&u=' . $current_language; ?>">Last</a></li>
			</ul>
		<?php } ?>
	</div>
</div>

<script type="text/javascript">
	$('.preview-thumbnail').popover({ html: true });
</script>
